<p id="title"><?php  echo $this->title; ?>  </p>
<form method="post" name="boo">
<?php
$action = 'insert';
if (isset ( $this->objectData )) {
	$action = 'update';
}
?>
<input type="hidden" name="actiontype" value="<?php echo $action;?>" />
<input type="hidden" name="Trip_id" id="trip_id"
	value="<?php echo $this->bind('id')?>">
<div class="elem">
		<label for="trip_car"> Car</label>
			<select name="Trip_car" id="trip_car">
				<?php		
					foreach ($this->cardata as $entity) {
						if ($this->bind('car') == $entity['id'])
							echo '<option selected="selected" value="'.$entity['id'].'" >'.$entity['numberplate'].'</option>';
						else
							echo '<option value="'.$entity['id'].'">'.$entity['numberplate'].'</option>';
					}					
				?>
			</select>
	</div>
<div class="elem">
		<label for="trip_driver"> Driver</label>
			<select name="Trip_driver" id="trip_driver">
				<?php		
					foreach ($this->driverdata as $entity) {
						if ($this->bind('driver') == $entity['id'])
							echo '<option selected="selected" value="'.$entity['id'].'" >'.$entity['username'].'</option>';
						else
							echo '<option value="'.$entity['id'].'">'.$entity['username'].'</option>';
					}					
				?>
			</select>
	</div>
<div class="elem">
	<label for="trip_starttime"> <?php echo Resource::getResource('starttime');?> </label> <input type="text"
		name="Trip_starttime" id="trip_starttime"
		value="<?php echo $this->bind('starttime')?>">
</div>
<div class="elem">
	<label for="trip_endtime"> <?php echo Resource::getResource('endtime');?> </label> <input type="text"
		name="Trip_endtime" id="trip_endtime"
		value="<?php echo $this->bind('endtime')?>">
</div>

<div class="elem">
		<label for="trip_route" style="width: 100%;"> <?php echo Resource::getResource('route');?> </label> 	
		<select name="Trip_route" id="trip_route" style="width: 75%;">
			<?php		
				foreach ($this->relativeData as $entity) {
					if ($this->bind('route') == $entity['routeid'])
						echo '<option selected="selected" value="'.$entity['routeid'].'" >'.$entity['pointstart'].' - '.$entity['pointend'].'</option>';
					else
						echo '<option value="'.$entity['routeid'].'">'.$entity['pointstart'].' - '.$entity['pointend'].'</option>';
				}					
			?>
		</select>
</div>
<div class="elem">
	<label for="trip_saleoff"><?php echo Resource::getResource('saleoff');?> </label> <input type="text"
		name="Trip_saleoff" id="trip_saleoff"
		value="<?php echo $this->bind('saleoff')?>">
</div>
<?php if($action=='insert')
		echo '<input type="hidden" name="Trip_status" id="trip_status" value="1">';
	?>

	<button type="submit" onclick="document.boo.submit()" style="display: none;">Save</button>
</form>
<script>
</script>